﻿using System.Web.Mvc;

namespace ComeSeeThis_MVC2.Models
{
    public class MotorFormView
    {
        #region Properties

        public Motor Motor { get; private set; }
        public SelectList Companies { get; private set; }
        public SelectList MotorSizes { get; private set; }
        public int MotorId { get; private set; }

        #endregion

        public MotorFormView(Motor motor)
        {
            Motor = motor;
            MotorId = motor.MotorId;
            //var defaultSize = "540";

            // Modify the value of the MotorTypeName to include the scale
            // This is done so that the scale shows up in the drop down list
            Companies = new SelectList(new CompanyRepository().GetAllCompanies(1, ProductType.Motor, false), "CompanyId", "CompanyName", motor.CompanyId);
            MotorSizes = new SelectList(new MotorRepository().GetAllMotorSizes(), "MotorSizeId", "MotorSizeName", motor.MotorSizeId);
        }
    }
}